package com.wangyadong.hobby.schedule.jobtask.linkedlist;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * <p>
 *
 * @author <714037465@qq.com>
 * @since 2018/8/158:35
 **/
public interface PositionalList<E> {


    int size();

    boolean isEmpty();

    /****first position***/
    Position<E> first();

    /****last position***/
    Position<E> last();

    /****before position p***/
    Position<E> before(Position<E> p) throws IllegalArgumentException;

    /****after position p***/
    Position<E> after(Position<E> p) throws IllegalArgumentException;

    /***insert to front of the list and return **/
    Position<E> addFirst(E e);

    /***insert to back of the list and return **/
    Position<E> addLast(E e);

    /*******insert position before position p*****/
    Position<E> addBefore(Position<E> p, E e);

    /*******insert position after position p*****/
    Position<E> addAfter(Position<E> p, E e);

    /*******repalce position and return *****/
    E set(Position<E> p, E e);

    E remove(Position<E> p) throws IllegalArgumentException;

    public static void main(String[] args) {
        String s = "{ " +
                "\"warningLogId\"" + ":" + "[\"2706315063602083797\", \"0000\"]}";

        JSONObject sss = (JSONObject) JSONObject.parse(s);
        JSONArray warningLogId = sss.getJSONArray("warningLogId");
        Iterator<Object> iterator = warningLogId.iterator();
        while (iterator.hasNext()) {
            String next = (String) iterator.next();
            System.out.println(next);
        }

    }
}
